﻿using System;
using System.ComponentModel;

namespace Borg
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public sealed class PlugAttribute : Attribute
    {
        [CodeSupportDescription(Accelerator = '1', Group = "Event", MethodPostFix = "_Plugging", Order = 1)]
        public string OnPlugging = string.Empty;

        [CodeSupportDescription(Accelerator = '2', Group = "Event", MethodPostFix = "_Plugged", Order = 2)]
        public string OnPlugged = string.Empty;

        [CodeSupportDescription(Accelerator = '3', Group = "Event", MethodPostFix = "_UnPlugging", Order = 3)]
        public string OnUnplugging = string.Empty;

        [CodeSupportDescription(Accelerator = '4', Group = "Event", MethodPostFix = "_UnPlugged", Order = 4)]
        public string OnUnplugged = string.Empty;

        public string ForSlot;

        [CodeSupportDescription(Accelerator = 'R', Group = "Property", Order = 1)]
        [DefaultValue(typeof(bool), "true")]
        public bool AutoRegister;

        [DefaultValue(typeof(bool), "true")]
        [CodeSupportDescription(Accelerator = 'P', Group = "Property", Order = 2)]
        public bool AutoPlug;

        public PlugAttribute(string forSlot)
        {
            ForSlot = forSlot;
            AutoRegister = true;
            AutoPlug = true;
        }
    }
}

